package client

import (
	"yunj/app/controller"
	"yunj/pkg/yunj/core/response"

	"github.com/gin-gonic/gin"
)

type Controller struct {
	controller.Controller
}

// 模板渲染
// @Param  path  string  模板路径
// @Param  data  map[string]any  渲染数据
func (ctrl *Controller) Render(ctx *gin.Context, path string, data ...map[string]any) {
	// 处理传入参数
	if len(data) > 0 {
		ctrl.Assign(data[0])
	}
	// 模板渲染
	response.Render(ctx, "client/"+path, ctrl.Data)
}
